package com.shopping.response;

import lombok.Data;
import lombok.experimental.UtilityClass;

@Data
public class Result<T> {

    private Integer code;
    private String message;
    private T data;

    public Result(String t){
        message=t;
    }

    public Result(Integer code,String message){
        this.code=code;
        this.message=message;
    }

    public static <T> Result success(String  message){
        return new Result(0,message);
    }

    public static <T> Result error(CodeMsg codeMsg){
        return new Result(codeMsg.getCode(),codeMsg.getMessage());
    }
}
